package com.qf.im.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.im.dao.HouseDao;
import com.qf.im.entity.House;
import com.qf.im.entity.bo.HouseEsBo;
import com.qf.im.service.HouseService;
import com.qf.im.service.IHourseSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 房屋表(House)表服务实现类
 *
 * @author makejava
 * @since 2023-11-09 09:19:28
 */
@Service("houseService")
public class HouseServiceImpl extends ServiceImpl<HouseDao, House> implements HouseService {

    @Autowired
    private IHourseSearchService hourseSearchService;

    @Override
    @Transactional
    public boolean save(House entity) {
        //保存到数据库
        super.save(entity);//Mybatis有主键回填的功能
        //保存到索引库
        hourseSearchService.save(entity.convertBo(HouseEsBo.class));
        return true;
    }
}

